package fair.controller;

import fair.pojo.User;
import fair.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.sql.DataSource;

/**
 * @author fair_wu
 * @version v1.0
 * @date 2021-02-17 下午 19:51
 */

@RestController
public class HelloController {

    @Autowired
    private DataSource dataSource;

    @Autowired
    private UserService userService;

    @GetMapping("/hello")
    public String hello() {
        System.out.println("DataSource" + dataSource);
        return "hello springboot";
    }

    @GetMapping("/user/{id}")
    public User queryUserById(@PathVariable Long id){
        return userService.queryById(id);
    }
}
